#!/usr/bin/env python3

import os
from bs4 import BeautifulSoup
import requests

prefix = 'https://knewone.com'
url = prefix + '/discover?page='

def get_detail_info(url, data = None):
    webdata = requests.get(url, timeout=10)

    soup = BeautifulSoup(webdata.text, 'lxml')

    covers = soup.select('a.cover-inner > img')
    titles = soup.select('h4.title > a')
    links = soup.select('h4.title > a')

    for cover, title, link in zip(covers, titles, links):
        data = {
                'cover' : cover.get('src'),
                'title' : title.get('title'),
                'link' : prefix + link.get('href')
                }
        print(data)

for num in range(1, 10):
    get_detail_info(url + str(num))

